import PdfReader from "../components/PdfReader.vue";
import Setting from "../views/Setting.vue";
import Report from "../views/Report.vue";
import WordList from "../views/WordList.vue";

import {  createRouter, createWebHashHistory } from "vue-router";
import Login from "../views/user/Login.vue";
import Main from "../views/Main.vue";
import Register from "../views/user/Register.vue";
const routes = [
  { path: "/login", component: Login, name: "login" },
  { path: "/register", component: Register, name: "register" },


  { path: "/", redirect: "/reader/pdf" }, // 根路径重定向
  {
    path: "/reader",
    component: Main,
    name: "reader",
    redirect: "/reader/pdf",
    children: [
       { path: "/reader/pdf", component: PdfReader, name: "pdf" }, // 添加默认子路由
      { path: "/reader/setting", component: Setting, name: "setting" },
      { path: "/reader/report", component: Report, name: "report" },
      { path: "/reader/wordList", component: WordList, name: "wordList" },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory (),
  routes,
});

export default router;